'use strict';

let debug = require('debug')('category');
let mongoDao = new require('./mongo/User.js')();

let DaoDispatcher = function () {
};
module.exports = new DaoDispatcher();

let theProto = DaoDispatcher.prototype;

/**
 * 添加单个entity
 * @param json
 * @returns {*}
 */
theProto.addOne = function*(json) {
    let result = yield mongoDao.save(json);
    return result;
};

/**
 * add many
 * @param json
 */
theProto.addBatch = function *(json) {
    let result = yield mongoDao.saveMany(json);
    return result;
};

/**
 {
    "email":"xx",
    "password":"xxx"
 }
 * @param json
 */
theProto.check = function*(json) {
    let result = yield mongoDao.check(json);
    return result;
};
